package cn.onesdream.app.api.controller;

import cn.onesdream.app.api.service.HelpService;
import cn.onesdream.app.common.util.ResponseResult;
import cn.onesdream.app.dao.entity.Help;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

@RestController
@RequestMapping("/api/help")
@Slf4j
@Api(tags = "建议书相关接口")
@Validated
public class HelpContorller {

    @Autowired
    private HelpService helpService;

    @ApiOperation("获取建议书内容")
    @GetMapping("/{helpId}")
    public ResponseResult<Help> help(@PathVariable("helpId") @NotNull Integer helpId){
        Help help=helpService.getHelp(helpId);
        return new ResponseResult<>(help);
    }
}
